/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Cliente.util;

import javax.swing.JPanel;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.CategoryDataset;

/**
// *
 * @author Caio Valentim
 */
public class GeradorDeGrafico {
    
    public void criaGrafico(CategoryDataset cds,JPanel panel) {
        String titulo = "Gráfico";
        String eixoy = "Número de Pacientes";
        String txt_legenda = "Ledenda:";
        boolean legenda = true;
        boolean tooltips = true;
        boolean urls = true;
        JFreeChart graf = ChartFactory.createBarChart3D(titulo, txt_legenda, eixoy, cds, PlotOrientation.VERTICAL, legenda, tooltips, urls);
        ChartPanel myChartPanel = new ChartPanel(graf, true);
        myChartPanel.setSize(panel.getWidth(), panel.getHeight());
        myChartPanel.setVisible(true);
        panel.removeAll();
        panel.add(myChartPanel);
        panel.revalidate();
        panel.repaint();
    }
    
    
}
